package com.tuanzhang.zhw.rpc.config;


import org.apache.commons.lang3.StringUtils;

import java.util.concurrent.atomic.AtomicInteger;

public abstract class AbstractRpcConfig {

    private AtomicInteger generator = new AtomicInteger(0);
    protected String id;
    protected String interfaceName;
    protected Class<?> proxyClass = null;

    public AtomicInteger getGenerator() {
        return generator;
    }

    public void setGenerator(AtomicInteger generator) {
        this.generator = generator;
    }

    public String getId() {
        if (StringUtils.isBlank(id)) {
            id = "rpc-" + generator.getAndIncrement();
        }
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getInterfaceName() {
        return interfaceName;
    }

    public void setInterfaceName(String interfaceName) {
        this.interfaceName = interfaceName;
    }


    public void setProxyClass(Class<?> proxyClass) {
        this.proxyClass = proxyClass;
    }
}

